<template>
  <div class="transaction" :style="{'min-height':bodyHeight+'px'}">
    <x-header :left-options="{backText: ''}">交易明细</x-header>
    <div>
      <ul class="transactionTitle clearfix">
        <li>时间</li>
        <li>类型</li>
        <li>交易金额</li>
        <div style="clear:both "></div>
      </ul>
      <ul class="transactionContOne clearfix">
        <div class="fr" v-for="transaction in transactionList">
          <li>{{transaction.created |formatDate}}</li>
          <li class="contentBox">{{transaction.content|formatDate}}</li>
          <li class="negative contentBox" v-if="transaction.countn[0]=='-'">{{transaction.countn}}</li>
          <li class="positive contentBox" v-if="transaction.countn[0]=='+'">{{transaction.countn}}</li>
          <div style="clear:both "></div>
        </div>
      </ul>
    </div>
  </div>
</template>
<script>
  // import { XHeader } from 'vux'
  import { XHeader, Confirm, Group, XSwitch, XButton, TransferDomDirective as TransferDom } from 'vux'
  import http from '../../service/http.js'
  export default {
    data() {
      return {
        transactionList: [],
        bodyHeight:""
      }
    },
    mounted() {
      this.bodyHeight = document.documentElement.clientHeight
      this.getList()
    },
    methods: {
      getList() {
        http.get("/user/balance").then((res) => {
          if (res.status == 200) {
            this.transactionList = res.data.body
          }
        })
      }
    },
    components: {
      XHeader,
      Confirm,
      Group,
      XSwitch,
      XButton
    }
  }
</script>
<style lang="less">
  .transaction{
    background: #f6f6f6;
  }

  .transaction .vux-header {
    background: #fff;
  }

  .transaction .c6 {
    color: #666;
  }

  .transaction .fr {
    position: relative;
  }

  .transaction .fa {
    position: absolute;
  }

  .transaction .r10 {
    right: 10px;
    ;
  }

  .transaction .c9 {
    color: #999;
  }

  .transaction .transactionMoeny {
    position: absolute;
    right: 10px;
  }

  .transaction .vux-header .vux-header-left .left-arrow:before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid #000;
    border-width: 1px 0 0 1px;
    -webkit-transform: rotate(315deg);
    transform: rotate(315deg);
    top: 8px;
    left: 7px;
  }

  .transaction .vux-header .vux-header-title {
    line-height: 40px;
    text-align: center;
    font-size: 18px;
    font-weight: 400;
    color: #000;
  }

  .transactionTitle {
    text-align: center;
  }

  .transactionTitle li {
    float: left;
    list-style: none;
    color: #999;
    font-size: 16px;
    height: 35px;
    line-height: 35px;
    width: 33.33%;
  }

  .transactionContOne {
    background: #fff;
    text-align: center;
  }
  .transactionContOne div li:first-child{
    text-align: center;
  }
  .transactionContOne li {
    color: #333;
    float: left;
    height: 50px;
    line-height: 50px;
    border-bottom: 1px solid #f6f6f6;
    list-style: none;
    width: 33.33%;
  }

  .transaction .transactionContOne .positive {
    color: #81d425 !important;
  }

  .transaction .transactionContOne .negative {
    color: #ff1010 !important;
  }

  .transaction .transactionContOne .contentBox {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
</style>